<?php 

	//接受参数
	$p = isset($_GET['p']) ? $_GET['p'] : 1;

	$num = isset($_GET['num']) ? $_GET['num'] : 20;

	//引入Model类
	include './Model.php';

	//实例化对象
	$mod = new Model('goods');

	//获取总数据
	$count = $mod->count();

	//引入Page类
	include './Page.php';

	//实例化Page
	$page = new Page($num,$count);

	//limit
	$limit = $page->getLimit();

	//echo $limit;

	$res = $mod->limit($limit)->select();
	
	if($res){
		$str = json_encode($res);
		echo $str;
	} else {

		echo 1;
	}


